Export an iPython Notebook Dashboard to HTML, PDF and a Slideshow

HTML

By default, nbconvert will produce an HTML file. To do that, run the following command:

jupyter nbconvert --to html --execute 'name_of_notebook.ipynb'

PDF

To convert a Jupyter (iPython) notebook to a PDF file, you need to first install Pandoc. Pandoc can be installed on Windows, Mac OS X and Linux.

Once Pandoc is installed, add the following line to your ~/.jupyter/jupyter_nbconvert_config.py file. This will ensure a PDF can be generated and it won't timeout while running the notebook. Depending on how much data your notebook needs to import before running, you may need to increase or decrease the timeout value.

c.ExecutePreprocessor.timeout = 300

Next you need to install Latex. On the Mac, you can download MacTeX. For other operating systems visit the LaTeX website.

If you get an error when trying to convert your notebook to a PDF, I suggest using wkhtmltopdf.

To convert a notebook to PDF using LaTeX, use the following command:

jupyter nbconvert --to pdf --execute 'name_of_notebook.ipynb'

To convert a notebook to PDF using wkhtmltopdf, do the following:

First, convert the notebook to HTML

jupyter nbconvert --to html --execute 'name_of_notebook.ipynb'

Next use wkhtmltopdf to convert the HTML to a PDF

wkhtmltopdf name_of_notebook.html name_of_notebook.pdf

Slideshow

Converting a notebook to slides generates a reveal.js HTML slideshow. In order to work correctly, it must be served by a web server.

If you produce actual slides from your notebook, download the reveal.js library to make them interactive.

Creating even a single-page slideshow is my preference as I believe it looks the best of all the exported formats.

To convert the notebook to slides, run the following command:

jupyter nbconvert --to slides --execute 'name_of_notebook.ipynb'

In [ ]: